/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package moteur.carte;
import moteur.Terrain;

/**
 *
 * @author nlupins
 */
public abstract class Arc extends Clickable implements Road {

    /**
     * Ville de destination
     */
    protected Ville dest;
    /**
     * Ville d'oigine.
     */
    protected Ville orig;
    /**
     * type de terrain (enum)
     */
    protected Terrain terrain;

    /**
     * 
     * @param t
     */
    public Arc(Terrain t){
        terrain = t;
    }
    /**
     *
     */
    public Arc() {
    }

    /**
     *
     * @return
     */
    public Ville getDest() {
        return dest;
    }

    /**
     *
     * @param dest
     */
    public void setDest(Ville dest) {
        this.dest = dest;
    }

    /**
     *
     * @return
     */
    public Ville getOrig() {
        return orig;
    }

    /**
     *
     * @param d
     * @return
     */
    public Ville getArrive(Ville d){
        if(d.equals(dest)){return orig;}else{return dest;}
    }


    /**
     *
     * @param orig
     */
    public void setOrig(Ville orig) {
        this.orig = orig;
    }

    @Override
    public String toString() {
        return orig.toString() +" "+ dest.toString() +" "+ terrain.name();
    }

    /**
     *
     * @return
     */
    @Override
    public Terrain getTerrain() {
        return terrain;
    }

    /**
     *
     * @param terrain
     */
    public void setTerrain(Terrain terrain) {
        this.terrain = terrain ;
    }
    

}
